<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTenantsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $table_name = 'tenants';
        Schema::create($table_name, function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('admin_id')->default(0)->index()->comment('后台管理员ID');
            $table->string('admin_prefix')->default('')->comment('后台管理prefix');
            $table->string('phone', 20)->comment('手机');
            $table->string('app_id', 100)->default('')->comment('公众号APPID');
            $table->string('mch_id', 100)->default('')->comment('微信商户ID');
            $table->string('mch_key', 100)->default('')->comment('微信商户KEY');
            $table->string('cert_path', 100)->default('')->comment('证书PEM保存路径');
            $table->string('key_path', 100)->default('')->comment('证书KEY保存路径');
            $table->string('weapp_id', 100)->default('')->comment('小程序appid');
            $table->string('md5_weapp_id', 100)->default('')->comment('MD5小程序appid');
            $table->string('weapp_secret', 100)->default('')->comment('小程序secret');
            $table->string('name', 100)->comment('名称');
            $table->string('short_name', 100)->default('')->comment('简称');
            $table->string('logo_url')->default('')->comment('LOGO URL地址');
            $table->string('logo_path')->default('')->comment('LOGO保存地址');
            $table->string('contact_number')->default('')->comment('联系电话');
            $table->string('province_id', 20)->default('')->comment('省份ID');
            $table->string('city_id', 20)->default('')->comment('城市ID');
            $table->string('district_id', 20)->default('')->comment('区/县ID');
            $table->string('address', 100)->default('')->comment('详细地址');
            $table->string('longitude', 100)->default('')->comment('经度');
            $table->string('latitude', 100)->default('')->comment('纬度');
            $table->boolean('is_block')->default(false)->comment('禁用:1=是,0=否');
            $table->timestamps();
        });
        add_table_comment($table_name, '租户表');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tenants');
    }
}
